import MusicManager from "../../../../MusicManager";
import RocketBase from "../../../facility/priveteFacility/RocketBase";
import { Killer } from "../../../funcObj/interface/HealthPoint";
import FlyerMissile from "../FlyerMissile";

const { ccclass, property } = cc._decorator;
/**
 * 火箭炮
 */
@ccclass
export default class Rocket extends FlyerMissile {

    @property([cc.SpriteFrame])
    rocketColor: cc.SpriteFrame[] = [];

    init(base: RocketBase): void {
        super.init(base);
        cc.find("body/color", this.node).getComponent(cc.Sprite).spriteFrame = this.rocketColor[base.player.playerId];
    }

    

    protected preDispatch(): void {
        super.preDispatch();
        MusicManager.instance.play(MusicManager.instance.rocketFire, this.node);
    }

    die(killer: Killer): void {
        MusicManager.instance.play(MusicManager.instance.rocketBomb, this.node);
        super.die(killer);
    }
}
